<!--
 * @Author: xuhy 1727317079@qq.com
 * @Date: 2022-09-15 20:12:24
 * @LastEditors: xuhy 1727317079@qq.com
 * @LastEditTime: 2022-09-15 20:37:57
 * @FilePath: \vue3_test\src\components\SonOne.vue
 * @Description: 后代组件
-->
<template>
  <div class="son">
    <h3>我是Son组件(孙), {{ car.name }}---{{ car.price }}</h3>
  </div>
</template>

<script>
import { inject } from "vue";
export default {
  name: "SonOne",
  setup() {
    let car = inject("car");
    console.log(car, "---Son---");
    return {
      car,
    };
  },
};
</script>

<style>
.son {
  background-color: orange;
  padding: 10px;
}
</style>
